<%= error_messages_for :smart_group_rule %>

<% @item = @smart_group %>
<%= render :partial => "shared/admin_box" %>


<p><h3><label>Smart Group Name:</label>
	<%= @smart_group.name %></h3></p>
	
<p><label>Definition:</label><br>
	<%= @smart_group.definition %></p>

<%= link_to 'Edit', :action => 'edit', :id => @smart_group %> |
<%= link_to 'List', :controller => 'smart_groups', :action => 'list' %>

<br>
<br>

<fieldset><legend><strong>Rules for This Smart Group</strong></legend>
<div id="smart_group_rules">
	<%= render :partial => "rules", :locals => {:smart_group => @smart_group} %>
</div>
</fieldset>

<br><br>
<strong>Add a Rule</strong>
<% @properties = SmartGroupProperty.find_allowed(current_user.id) %>
<div>
	<% form_remote_tag :url => {:action => 'add_rule_show', :smart_group_id => @smart_group} do %>
	<% fields_for :rule do %>
	<span id ="property">
		<%= collection_select('property', 'id', @properties, 'id', 'prose', options = {:prompt => "--select a property--" })%>
	</span>
	
	<%= observe_field 'property_id',
	 				 :url => {:action => 'property_changed_show'},
					 :with => 'id' %>
	
	<span id="operator_span">
		
	</span>
	<span id="value">
		
	</span>
	<span>
			<%= submit_tag 'Add Rule' %>
	</span>
	<% end %>
	<% end %>
</div>

<div id="edit-rules">
	
</div>
